<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>添加广告</title>
<script src="js/jquery-1.9.0.js"></script>
<script src="js/jquery.validate.min.js"></script>
<script src="js/WarnMessages.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />  

<link href="css/css.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" rev="stylesheet" href="css/style.css" type="text/css" media="all" />
<script type="text/javascript" charset="utf-8" src="ueditor/editor_config.js"></script>
<script type="text/javascript" charset="utf-8" src="ueditor/editor_all.js"></script>
<!-- <script src="http://code.jquery.com/jquery-1.9.1.js"></script>   -->
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>  

<script>  
	$(function() {    
		$( "#txtDate" ).datepicker({ dateFormat: "yy-mm-dd" }); 
		$( "#txtDate1" ).datepicker({ 
			dateFormat: "yy-mm-dd"
			
    	});  
	}); 
</script>

<style type="text/css">
<!--
.atten {
	font-size: 12px;
	font-weight: normal;
	color: #F00;
}
-->
</style>
<script type="text/javascript">
	function loginName() {
		$.ajax({
			type : "post",//发送方式       
			url : "admin/findAllAdsPosList.action",// 路径   
			data : "",
			success : function(dataRole) {
				var obj = new Function("return" + dataRole)();//
				var html = "<option value='0'>--请选择--</option>";
				for ( var i = 0; i < obj.length; i++) {
					html += "<option value='"+obj[i].adsPosId+"'>"
							+ obj[i].adsPos + "</option>";
				}
				$("#ajaxJsonSelectId>option").remove();
				$("#ajaxJsonSelectId").append(html);
			}
		});
	}
	
	
	/*****以下是表单验证****/
$(function(){
	
	$("#myform").validate({
	rules:{
			'beginDate':{
			required:true
			},
			'endDate':{
			required:true
			},
			'ads.adsName':{
			required:true
			},
			'ads.url':{
			required:true
			},
			'ads.adsPosId':{
			required:true
			},
			'upload':{
			required:true
			},
			'ads.remarks':{
			required:true
			}
		}
	});
    });
    /*****以上是表单验证****/	
</script>
</head>

<body class="ContentBody" onload="loginName()">
<form id="myform" action="admin/addAds" method="post" enctype="multipart/form-data">
	<div class="MainDiv">
	<table width="99%" border="0" cellpadding="0" cellspacing="0" class="CContent">
	  <tr><th class="tablestyle_title" >添加广告内容</th></tr>
 	  <tr>
	    <td class="CPanel">
			<table border="0px" cellpadding="0" cellspacing="0" style="width:100%">
				<tr>
					<td width="100%">
						<fieldset style="height:100%;">
						<legend>新建广告信息</legend>  
							  <table border="0px" cellpadding="2" cellspacing="1" width="900px">
								   <tr height="30px">
										<td width="30">&nbsp;</td>
									    <td align="right"  width="90px">开始时间:</td>
									    <td>
									    	<input type="text" id="txtDate" name="beginDate"/>
									    	&nbsp;&nbsp;&nbsp;&nbsp;结束时间:
									    	<input type="text" id="txtDate1" name="endDate"/>
									    </td>
								   </tr>
								   <tr height="30px">
										<td>&nbsp;</td>
									    <td align="right">广告标题:</td>
									    <td><input name="ads.adsName" style="height:23px;" type="text" class="text"  size="80"/></td>
								   </tr>
								   <tr height="30px">
										<td>&nbsp;</td>
									    <td align="right">广告链接地址:</td>
									    <td><input name="ads.url" style="height:23px;" type="text" class="text"  size="80"/></td>
								   </tr>
								   <tr height="30px">
										<td>&nbsp;</td>
									    <td align="right">选择广告位置:</td>
									    <td>
									    	<select id="ajaxJsonSelectId" name="ads.adsPosId" style="width: 130px;">
    										</select>
    										图片大小：首页中部，期刊分类695*115，首页左下角240*100，文章阅读315*195
									    </td>
								   </tr>
								   <tr height="30px">
										<td>&nbsp;</td>
									    <td align="right">选择广告图片:</td>
									    <td><input type="file"  name="upload" style="height:23px;" class="text"  size="80"/></td>
								   </tr>
							       <tr>
										<td>&nbsp;</td>
								       	<td align="right" valign="top">广告内容备注:</td>
								       	<td><textArea id="editor" name="ads.remarks" type="text/plain">这里可以书写，编辑器的初始内容</textArea></td>
							       </tr>
							       <tr height="40px">
										<td>&nbsp;</td>
							       		<td>&nbsp;</td>
										<td align="center">
											<input type="submit" class="right-button02" value="提交" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
											<input type="reset" class="right-button02" value="重置" />
										</td>
									</tr>
							  	</table>
							</fieldset>			
						</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
</div>	
</form>						   
</body>
<script type="text/javascript">
    //实例化编辑器
    var ue = UE.getEditor('editor');

    ue.addListener('ready',function(){
        this.focus();
    });

</script>

</html>
